using Assets.Scripts.GDK;
using UnityEngine;

namespace Brick
{
	public class gdk_info : MonoBehaviour
	{
		private float m_LastUpdateShowTime;

		private float m_UpdateShowDeltaTime = 0.01f;

		private int m_FrameUpdate;

		private float m_FPS;

		private void Awake()
		{
			Application.targetFrameRate = 100;
		}

		private void Start()
		{
			m_LastUpdateShowTime = Time.realtimeSinceStartup;
		}

		private void Update()
		{
			m_FrameUpdate++;
			if (Time.realtimeSinceStartup - m_LastUpdateShowTime >= m_UpdateShowDeltaTime)
			{
				m_FPS = (float)m_FrameUpdate / (Time.realtimeSinceStartup - m_LastUpdateShowTime);
				m_FrameUpdate = 0;
				m_LastUpdateShowTime = Time.realtimeSinceStartup;
			}
		}

		private void OnGUI()
		{
			if (gdk_game_manager.isDebug)
			{
				GUI.Label(new Rect(10f, 10f, 100f, 100f), "FPS: " + m_FPS);
			}
		}
	}
}

